package com.example.a1.util;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.example.a1.R;

public class GlideUtil {
    // 加载网络图片
    public static void loadImage(Context context, String url, ImageView imageView) {
        Glide.with(context)
                .load(url)
                .placeholder(R.drawable.ic_launcher_background) // 占位图
                .error(R.drawable.ic_launcher_foreground) // 错误图
                .diskCacheStrategy(DiskCacheStrategy.ALL) // 缓存策略
                .into(imageView);
    }
}